
#include <algorithm>
#include <functional>
#include <iostream>
#include <numbers>
#include <utility>
#include <vector>

template <typename Function, typename SecondArgType>
class partial_application_on_2nd_impl {
public:
    partial_application_on_2nd_impl(Function func, SecondArgType second_arg)
        : m_function(func)
        , m_second_arg(second_arg)
    {
    }

    template <typename FirstArgType>
    auto operator()(FirstArgType&& first_arg) const
    {
        return m_function(std::forward<FirstArgType>(first_arg), m_second_arg);
    }

private:
    Function m_function;
    SecondArgType m_second_arg;
};

template <typename Function, typename SecondArgType>
partial_application_on_2nd_impl<Function, SecondArgType>
bind2nd(Function&& func, SecondArgType&& second_arg)
{
    return (partial_application_on_2nd_impl<Function, SecondArgType>(std::forward<Function>(func),
        std::forward<SecondArgType>(second_arg)));
}

int main()
{
    std::vector<double> degrees = { 0, 30, 45, 60 };
    std::vector<double> radians(degrees.size());
    std::transform(degrees.cbegin(), degrees.cend(), radians.begin(), bind2nd(std::multiplies<>(), std::numbers::pi / 180));
    for (auto item : radians) {
        std::cout << item << " ";
    }
    std::cout << std::endl;
}